package com.zfei.gfb.request;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Validator;
import com.zfei.gfb.bean.Status;
import com.zfei.gfb.bean.StatusException;
import com.zfei.gfb.util.ObjUtil;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;


/**
 * @author fgh
 */
public class GfbLandResourcesAddRequest {

    // 资源名称
    @ApiModelProperty(value = "资源名称", required = true)
    private String name;
    // 联系电话
    @ApiModelProperty(value = "联系电话", required = true)
    private String phone;
    // 地图坐标
    @ApiModelProperty(value = "地图坐标", required = true)
    private String point;
    // 位置名称
    @ApiModelProperty(value = "位置名称", required = true)
    private String address;
    // 图片url集合
    @ApiModelProperty(value = "图片url集合", required = true)
    private List<String> images;
    // 类型 1:土地 2:池塘, 3: 山林
    @ApiModelProperty(value = "类型 1:土地 2:池塘, 3: 山林", required = true)
    private Integer type;
    // 招标内容
    @ApiModelProperty(value = "招标内容", required = true)
    private String content;


    public void setName(String value) {
        this.name = value;
    }

    public String getName() {
        return this.name;
    }

    public void setPhone(String value) {
        this.phone = value;
    }

    public String getPhone() {
        return this.phone;
    }

    public void setPoint(String value) {
        this.point = value;
    }

    public String getPoint() {
        return this.point;
    }

    public void setAddress(String value) {
        this.address = value;
    }

    public String getAddress() {
        return this.address;
    }

    public List<String> getImages() {
        return images;
    }

    public void setImages(List<String> images) {
        this.images = images;
    }

    public void setType(Integer value) {
        this.type = value;
    }

    public Integer getType() {
        return this.type;
    }

    public void setContent(String value) {
        this.content = value;
    }

    public String getContent() {
        return this.content;
    }


    public void checkInsertNull() {
        if (ObjUtil.anyNull(name, phone, point, address, images, type, content)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
//        if(!Validator.isMobile(phone)){
//            throw new StatusException(Status.INVALID_ARGUMENT);
//        }
        for (String image : images) {
            if (!Validator.isUrl(image)) {
                throw new StatusException(Status.INVALID_ARGUMENT);
            }
        }
    }

}

